<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>资金拨付 - 国省道 - 切换资金</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/Top.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/style.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/easyui/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/easyui/themes/icon.css" />
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/buttons.css" />
    <script type="text/javascript" src="${pageContext.request.contextPath}/easyui/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-form.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/easyui/datagrid-detailview.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/easyui/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/util/jquery.cookie.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/YMLib.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/YWLib.js"></script>
    <style type="text/css">
        .table{border: 1px solid #FFE7BA;}
        .table tr{border: 1px solid #FFE7BA;}
        .table tr td{border: 1px solid #FFE7BA;}
        .table tr td input{width: 50px;}
    </style>
    <style type="text/css">
        .table1{border: 1px solid #FFE7BA;}
        .table1 tr{border: 1px solid #FFE7BA;}
        .table1 tr td{border: 1px solid #FFE7BA;}
    </style>
    <script type="text/javascript">
        var xzqhstr;
        var anqxstr="";
        var resultId = "";
        var pageSize_ = 10;
        $(function () {
            resultId = getUrlParame("id");
            anqxstr = getxqxbyid(getUrlParame("id"));
            loadDist1("xzqh",$.cookie("dist"));
            loadBmbm3('xmnf','项目年份',new Date().getFullYear());
            loadFundJhxdwh("jhxdwh",'gs_gsdgz');
            loadBmbm3('shzt','审核状态');
            loadBmbm3('ssbzt','上报状态');
            loadBmbm3('xsbzt','上报状态');
            if($.cookie('unit2').length==11){
                $("td[name='xian']").show();
                $("td[name='shi']").hide();
                $("td[name='sheng']").hide();
                $("a[name='sheng']").hide();
                $("a[name='xian']").show();
                $("a[name='shi']").hide();
                if(anqxstr.indexOf("上报")!=-1){
                    $("a[name='xian']").show();
                }else{
                    $("a[name='xian']").hide();
                }
            }
            if($.cookie('unit2').length==9){
                $("td[name='shi']").show();
                $("td[name='xian']").hide();
                $("td[name='sheng']").hide();
                $("a[name='sheng']").hide();
                $("a[name='xian']").hide();
                $("a[name='shi']").show();
                if(anqxstr.indexOf("上报")!=-1){
                    $("a[name='shi']").show();
                }else{
                    $("a[name='shi']").hide();
                }
            }
            if($.cookie('unit2').length==7){
                $("a[name='sheng']").show();
                $("td[name='sheng']").show();
                $("td[name='xian']").hide();
                $("td[name='shi']").hide();
                $("a[name='xian']").hide();
                $("a[name='shi']").hide();
                if(anqxstr.indexOf("审核")!=-1){
                    $("a[name='sheng']").show();
                }else{
                    $("a[name='sheng']").hide();
                }
            }
            queryXmlist();
        });

        function exportXmList() {
            var xzqhdm = $("#xzqh").combotree("getValues");
            if(xzqhdm.length == 0) {
                xzqhstr = $.cookie("dist2");
            }else if(xzqhdm.length == 1) {
                if(xzqhdm[0].substr(xzqhdm[0].length-2,xzqhdm[0].length)=="00") {
                    xzqhdm[0]=xzqhdm[0].substr(0,xzqhdm[0].length-2);
                }
                if(xzqhdm[0].substr(xzqhdm[0].length-2,xzqhdm[0].length)=="00") {
                    xzqhdm[0]=xzqhdm[0].substr(0,xzqhdm[0].length-2);
                }
                xzqhstr = xzqhdm[0] ;
            }else{
                xzqhstr = xzqhdm.join(',');
            }
            var xmnf=$("#xmnf").combobox("getValues").join(",");
            if(xmnf.substr(0,1)==',') {
                xmnf=xmnf.substr(1,xmnf.length);
            }
            var jhxdwh=$("#jhxdwh").combobox("getText");
            if(jhxdwh.substr(0,1)==',') {
                jhxdwh=jhxdwh.substr(1,jhxdwh.length);
            }

            var data = "xzqh="+xzqhstr+"&xmnf="+xmnf+
                "&xmmc="+$("#xmmc").val()+"&jhxdwh="+jhxdwh+"&jsxz=切块资金&gydwdm=2360100";

            window.location.href = "/jxcsxm/funds/zjbf/exportXmList.do?"+data;

        }

        function queryXmlist() {
            var xzqhdm = $("#xzqh").combotree("getValues");
            if(xzqhdm.length == 0) {
                xzqhstr = $.cookie("dist2");
            }else if(xzqhdm.length == 1) {
                if(xzqhdm[0].substr(xzqhdm[0].length-2,xzqhdm[0].length)=="00") {
                    xzqhdm[0]=xzqhdm[0].substr(0,xzqhdm[0].length-2);
                }
                if(xzqhdm[0].substr(xzqhdm[0].length-2,xzqhdm[0].length)=="00") {
                    xzqhdm[0]=xzqhdm[0].substr(0,xzqhdm[0].length-2);
                }
                xzqhstr = xzqhdm[0] ;
            }else{
                xzqhstr = xzqhdm.join(',');
            }
            var xmnf=$("#xmnf").combobox("getValues").join(",");
            if(xmnf.substr(0,1)==',') {
                xmnf=xmnf.substr(1,xmnf.length);
            }
            var jhxdwh=$("#jhxdwh").combobox("getText");
            if(jhxdwh.substr(0,1)==',') {
                jhxdwh=jhxdwh.substr(1,jhxdwh.length);
            }

            var params = {
                'sbthcd': $.cookie("unit2").length,
                'xzqh':xzqhstr,
                'xmnf':xmnf,
                'xmmc':$("#xmmc").val(),
                'jhxdwh':jhxdwh,
                'jsxz':'切块资金',
                'gydwdm':'2360100',
                'shzt': getValuesById("shzt"),
                'ssbzt': getValuesById("ssbzt"),
                'xsbzt': getValuesById("xsbzt")
            };

            loadTj();

            $("#grid").datagrid({
                url:'/jxcsxm/funds/zjbf/queryXmlist.do',
                striped:true,
                pagination:true,
                rownumbers:true,
                pageNumber:1,
                pageSize:pageSize_,
                checkOnSelect:true,
                height:$(window).height()-155,
                width:$('#searchField').width()+2,
                queryParams: params,
                onSelectPage: function (pageNumber, pageSize) {
                    pageSize_ = pageSize;
                },
                onBeforeLoad: function () {
                    pageSize_ = $("#grid").datagrid("options").pageSize;
                },
                columns:[[
                    {field:'allSel',title:'全选',width:60,align:'center',rowspan:1,checkbox:'true'},
                    {field:'cz',title:'操作',width:130,align:'center',
                        formatter: function(value,row,index) {
                            var result='<a style="color:#3399CC;" href="javascript:openXmInfo('+"'"+row.xmbm+"','gs_funds','zjbf'"+')" >项目详情</a>&nbsp;';
                            result+='<a style="color:#3399CC;" href="javascript:openZjbf_standard('+"'"+row.xmbm+"','"+row.gydwdm+"','gs_funds','"+resultId+"'" + ')" >拨付详情</a>';
                            return result;
                           /* var result='<a style="color:#3399CC;" href="javascript:openXmInfo('+"'"+row.xmbm+"','gs_funds','jhcx'"+')" >项目详情</a>'
                            return result;*/
                        }
                    },
                    {field:'xmnf',title:'项目年份',width:60,align:'center'},
                    {field:'xmbm',title:'项目编码',width:60,align:'center'},
                    {field:'xmmc',title:'项目名称',width:400,align:'center'},
                    {field:'gydw',title:'管养单位',width:180,align:'center'},
                    {field:'xzqh',title:'行政区划',width:100,align:'center'},
                    {field:'jhxdwh',title:'计划下达文号',width:390,align:'center'}
                ]],
                rowStyler:function(index,row){
                    if($.cookie('unit2').length==11){
                        if (row.xsbzt>0 ){
                            return 'background-color:pink;color:black;font-weight:bold;';
                        }}
                    if($.cookie('unit2').length==9){
                        if (row.ssbzt>0 && row.xsbzt==0){
                            return 'background-color:pink;color:black;font-weight:bold;';
                        }}
                    if($.cookie('unit2').length==7){
                        if (row.shzt>0 && row.ssbzt==0){
                            return 'background-color:pink;color:black;font-weight:bold;';
                        }}
                }
            });
        }

        function loadTj() {
            var xzqhdm = $("#xzqh").combotree("getValues");
            if(xzqhdm.length == 0) {
                xzqhstr = $.cookie("dist2");
            }else if(xzqhdm.length == 1) {
                if(xzqhdm[0].substr(xzqhdm[0].length-2,xzqhdm[0].length)=="00") {
                    xzqhdm[0]=xzqhdm[0].substr(0,xzqhdm[0].length-2);
                }
                if(xzqhdm[0].substr(xzqhdm[0].length-2,xzqhdm[0].length)=="00") {
                    xzqhdm[0]=xzqhdm[0].substr(0,xzqhdm[0].length-2);
                }
                xzqhstr = xzqhdm[0] ;
            }else{
                xzqhstr = xzqhdm.join(',');
            }
            var xmnf=$("#xmnf").combobox("getValues").join(",");
            if(xmnf.substr(0,1)==',') {
                xmnf=xmnf.substr(1,xmnf.length);
            }
            var jhxdwh=$("#jhxdwh").combobox("getText");
            if(jhxdwh.substr(0,1)==',') {
                jhxdwh=jhxdwh.substr(1,jhxdwh.length);
            }

            var params = {
                'sbthcd': $.cookie("unit2").length,
                'xzqh': xzqhstr,
                'xmnf': xmnf,
                'xmmc': $("#xmmc").val(),
                'jhxdwh': jhxdwh,
                'shzt': getValuesById("shzt"),
                'ssbzt': getValuesById("ssbzt"),
                'xsbzt': getValuesById("xsbzt")
            };
            $.ajax({
                type:'post',
                url:'/jxcsxm/funds/getTjAll.do',
                data:params,
                dataType:'json',
                success:function(msg){
                    $("#xmsl").html(msg.xmsl);
                    $("#xdzbz").html(msg.xdzbz);
                    $("#xdbb").html(msg.xdbb);
                    $("#xdsb").html(msg.xdsb);
                    $("#xddf").html(msg.xddf);
                    $("#dwzbz").html(msg.dwzbz);
                    $("#dwbb").html(msg.dwbb);
                    $("#dwsb").html(msg.dwsb);
                    $("#dwdf").html(msg.dwdf);
                    $("#bfzbz").html(msg.bfzbz);
                    $("#bfbb").html(msg.bfbb);
                    $("#bfsb").html(msg.bfsb);
                    $("#bfdf").html(msg.bfdf);
                }
            });
        }

        function qbshdw() {
            var xzqhdm=$("#xzqh").combotree("getValues");
            if(xzqhdm.length==0){
                xzqhstr= $.cookie("dist2");
            }else if(xzqhdm.length==1){
                if(xzqhdm[0].substr(xzqhdm[0].length-2,xzqhdm[0].length)=="00") xzqhdm[0]=xzqhdm[0].substr(0,xzqhdm[0].length-2);
                if(xzqhdm[0].substr(xzqhdm[0].length-2,xzqhdm[0].length)=="00") xzqhdm[0]=xzqhdm[0].substr(0,xzqhdm[0].length-2);
                xzqhstr=xzqhdm[0] ;
            }else{
                xzqhstr= xzqhdm.join(',');
            }
            var jsxz="切块资金";
            var xmnf=$("#xmnf").combobox("getValues").join(",");
            if(xmnf.substr(0,1)==',') {
                xmnf=xmnf.substr(1,xmnf.length);
            }
            var jhxdwh=$("#jhxdwh").combobox("getText");
            if(jhxdwh.substr(0,1)==',') {
                jhxdwh=jhxdwh.substr(1,jhxdwh.length);
            }
            var params = {
                'xmjbxx.sbthcd':$.cookie("unit2").length,
                'xmjbxx.xzqh':xzqhstr,'xmjbxx.gcfl':jsxz,'xmjbxx.jsxz':'切块资金','xmjbxx.knw':'',
                'xmjbxx.xmnf':xmnf,'xmjbxx.xmmc':$("#xmmc").val(),'xmjbxx.jhxdwh':jhxdwh,
                'xmjbxx.shzt':getValuesById("shzt"),'xmjbxx.ssbzt':getValuesById("ssbzt"),
                'xmjbxx.xsbzt':getValuesById("xsbzt")
            };
            $.ajax({
                type:'post',
                url:'/jxcsxm/zjbf/qbshbf.do',
                data:params,
                dataType:'json',
                success:function(msg){
                    if(msg){
                        alert("审核成功");
                        $("#grid").datagrid('reload');
                        loadTj();
                    }
                    else{
                        alert("审核失败");
                    }
                }
            });
        }

        function qbthsj() {
            var xzqhdm=$("#xzqh").combotree("getValues");
            if(xzqhdm.length==0){
                xzqhstr= $.cookie("dist2");
            }else if(xzqhdm.length==1){
                if(xzqhdm[0].substr(xzqhdm[0].length-2,xzqhdm[0].length)=="00") xzqhdm[0]=xzqhdm[0].substr(0,xzqhdm[0].length-2);
                if(xzqhdm[0].substr(xzqhdm[0].length-2,xzqhdm[0].length)=="00") xzqhdm[0]=xzqhdm[0].substr(0,xzqhdm[0].length-2);
                xzqhstr=xzqhdm[0] ;
            }else{
                xzqhstr= xzqhdm.join(',');
            }
            var jsxz="切块资金";
            var xmnf=$("#xmnf").combobox("getValues").join(",");
            if(xmnf.substr(0,1)==',') {
                xmnf=xmnf.substr(1,xmnf.length);
            }
            var jhxdwh=$("#jhxdwh").combobox("getText");
            if(jhxdwh.substr(0,1)==',') {
                jhxdwh=jhxdwh.substr(1,jhxdwh.length);
            }
            var params =
                {
                    'xmjbxx.sbthcd':$.cookie("unit2").length,
                    'xmjbxx.xmbm':$("#xmbm").val(),'xmjbxx.xzqh':xzqhstr,
                    'xmjbxx.gcfl':jsxz,'xmjbxx.jsxz':'切块资金','xmjbxx.knw':'',
                    'xmjbxx.xmnf':xmnf,'xmjbxx.xmmc':$("#xmmc").val(),
                    'xmjbxx.jhxdwh':jhxdwh,
                    'xmjbxx.shzt':getValuesById("shzt"),'xmjbxx.ssbzt':getValuesById("ssbzt"),
                    'xmjbxx.xsbzt':getValuesById("xsbzt")
                };

            $.ajax({
                type:'post',
                url:'/jxcsxm/zjbf/qbthsj.do',
                data:params,
                dataType:'json',
                success:function(msg){
                    if(msg){
                        alert("退回成功");
                        $("#grid").datagrid('reload');
                        loadTj();
                    }
                    else{
                        alert("退回失败");
                    }
                }
            });
        }

        function qbthwsh() {
            var xzqhdm=$("#xzqh").combotree("getValues");
            if(xzqhdm.length==0){
                xzqhstr= $.cookie("dist2");
            }else if(xzqhdm.length==1){
                if(xzqhdm[0].substr(xzqhdm[0].length-2,xzqhdm[0].length)=="00") xzqhdm[0]=xzqhdm[0].substr(0,xzqhdm[0].length-2);
                if(xzqhdm[0].substr(xzqhdm[0].length-2,xzqhdm[0].length)=="00") xzqhdm[0]=xzqhdm[0].substr(0,xzqhdm[0].length-2);
                xzqhstr=xzqhdm[0] ;
            }else{
                xzqhstr= xzqhdm.join(',');
            }
            var jsxz="切块资金";
            YMLib.Var.params={'xmjbxx.xzqh':xzqhstr,'xmjbxx.jsxz':'切块资金','xmjbxx.gydwdm':2,'xmjbxx.gcfl':jsxz
            };
            YMLib.Var.data='xmjbxx.xzqh='+xzqhstr+'&xmjbxx.jsxz='+'切块资金'+'&xmjbxx.gydwdm='+2+'&xmjbxx.gcfl='+jsxz;
            if(confirm("请按填报时间进行退回未审核")) {
                openWindow("退回未审核", "/jxcsxm/page/zjbf/zjbf_thwsh.jsp", 400, 350);
            }
        }
    </script>
</head>
<body>
    <div id="righttop">
        <div id="p_top">资金拨付>&nbsp;普通国省道>&nbsp;切换资金</div>
    </div>
    <table width="99.9%" border="0" style="margin-top: 1px; margin-left: 1px;" cellspacing="0" cellpadding="0">
        <tr>
            <td align="left" style="padding-left:10px;padding-right: 10px; padding-top: 5px;">
                <fieldset id="searchField" style="width:99.9%; text-align: left; vertical-align: middle;">
                    <legend style="padding: 0 0 0 0; font-weight: bold; color: Gray; font-size: 12px;">
                        <font style="color: #0866A0; font-weight: bold"></font>
                    </legend>
                    <div>
                        <table style="margin:4px; vertical-align:middle;" cellspacing="0" class="abgc_td" >
                            <tr height="28">
                                <td align="right">行政区划：</td>
                                <td><select id="xzqh" style="width:165px;"></select></td>
                                <td align="right">项目年份：</td>
                                <td><select id="xmnf" style="width: 80px;"></select></td>
                                <td align="right">项目名称：</td>
                                <td><input name="xmmc" type="text" id="xmmc" style="width:140px;" /></td>
                                <td align="right">计划下达文号：</td>
                                <td><input name="jhxdwh" type="text" id="jhxdwh" style="width:165px;" /></td>
                            </tr>
                            <tr height="28">
                                <td align="right" name='sheng'>审核状态：</td>
                                <td name='sheng'><select name="shzt" id="shzt" style="width:80px;" ></select></td>
                                <td align="right" name='shi'>上报状态：</td>
                                <td name='shi'><select name="ssbzt" id="ssbzt" style="width:80px;" ></select></td>
                                <td align="right" name='xian'>上报状态：</td>
                                <td name='xian'><select name="xsbzt" id="xsbzt" style="width:80px;" ></select></td>
                            </tr>
                            <tr height="28">
                                <td colspan="8">
                                    <a id='mybuttion1' style="margin-top: 1px;margin-bottom: 1px;" href="javascript:queryXmlist()" onmouseover="szgq('button button-tiny button-glow button-rounded button-raised button-primary','mybuttion1')" onmouseout="szgq('button button-tiny button-rounded button-raised button-primary','mybuttion1')"  class="button button-tiny button-rounded button-raised button-primary">查询</a>
                                    <a name='sheng' id='mybuttion14' style="margin-top: 1px;margin-bottom: 1px;" href="javascript:plshbf()" onmouseover="szgq('button button-tiny button-glow button-rounded button-raised button-primary','mybuttion2')" onmouseout="szgq('button button-tiny button-rounded button-raised button-primary','mybuttion2')"  class="button button-tiny button-rounded button-raised button-primary">批量审核</a>
                                    <a name='sheng' id='mybuttion10' style="margin-top: 1px;margin-bottom: 1px;" href="javascript:qbshdw()" onmouseover="szgq('button button-tiny button-glow button-rounded button-raised button-primary','mybuttion10')" onmouseout="szgq('button button-tiny button-rounded button-raised button-primary','mybuttion10')"  class="button button-tiny button-rounded button-raised button-primary">全部审核</a>
                                    <a name='sheng' id='mybuttion15' style="margin-top: 1px;margin-bottom: 1px;" href="javascript:qbthsj()" onmouseover="szgq('button button-tiny button-glow button-rounded button-raised button-primary','mybuttion15')" onmouseout="szgq('button button-tiny button-rounded button-raised button-primary','mybuttion15')"  class="button button-tiny button-rounded button-raised button-primary">全部退回</a>
                                    <a name='sheng' id='mybuttion71' style="margin-top: 1px;margin-bottom: 1px;" href="javascript:qbthwsh()" onmouseover="szgq('button button-tiny button-glow button-rounded button-raised button-primary','mybuttion42')" onmouseout="szgq('button button-tiny button-rounded button-raised button-primary','mybuttion41')"  class="button button-tiny button-rounded button-raised button-primary">全部退回未审核</a>
                                    <a name='shi' id='mybuttion6' style="margin-top: 1px;margin-bottom: 1px;" href="javascript:plsbbfsj()" onmouseover="szgq('button button-tiny button-glow button-rounded button-raised button-primary','mybuttion6')" onmouseout="szgq('button button-tiny button-rounded button-raised button-primary','mybuttion6')"  class="button button-tiny button-rounded button-raised button-primary">批量上报</a>
                                    <a id='mybuttion2' style="margin-top: 1px;margin-bottom: 1px;" href="javascript:exportXmList()" onmouseover="szgq('button button-tiny button-glow button-rounded button-raised button-primary','mybuttion1')" onmouseout="szgq('button button-tiny button-rounded button-raised button-primary','mybuttion1')"  class="button button-tiny button-rounded button-raised button-primary">导出</a>
                                </td>
                            </tr>
                        </table>
                    </div>
                </fieldset>
            </td>
        </tr>
        <tr>
            <td style="padding-left: 10px; font-size:12px;">
                <table>
                    <tr>
                        <td colspan="2">共有项目【<span id="xmsl" style="color: red;font-weight: bold;">0</span>】个。</td>
                    </tr>
                    <tr>
                        <td>下达补助【<span id="xdzbz" style="color: Red; font-weight: bold;">0</span>】万元（部补【<span id="xdbb" style="color: Red; font-weight: bold;">0</span>】万元，省补【<span id="xdsb" style="color: Red; font-weight: bold;">0</span>】万元），地方自筹【<span id="xddf" style="color: Red; font-weight: bold;">0</span>】万元。</td>
                        <td style="padding-left: 10px;">到位补助【<span id="dwzbz" style="color: Red; font-weight: bold;">0</span>】万元（部补【<span id="dwbb" style="color: Red; font-weight: bold;">0</span>】万元，省补【<span id="dwsb" style="color: Red; font-weight: bold;">0</span>】万元），地方自筹【<span id="dwdf" style="color: Red; font-weight: bold;">0</span>】万元。</td>
                    </tr>
                    <tr>
                        <td>拨付补助【<span id="bfzbz" style="color: Red; font-weight: bold;">0</span>】万元（部补【<span id="bfbb" style="color: Red; font-weight: bold;">0</span>】万元，省补【<span id="bfsb" style="color: Red; font-weight: bold;">0</span>】万元），地方自筹【<span id="bfdf" style="color: Red; font-weight: bold;">0</span>】万元。</td>
                    </tr>
                </table>
                <div><table id="grid"></table></div>
            </td>
        </tr>
    </table>
</body>
</html>
